/*
 * @Description: 
 * @version: 
 * @Author: cy
 * @Date: 2021-07-19 09:23:06
 * @LastEditors: cy
 * @LastEditTime: 2021-07-19 10:29:59
 */
export default class Stack {
    constructor() {
        this.items = [];
    }
    push(element) {
        this.items.push(element);
    }
    pop() {
        return this.items.pop();
    }
    // 查看栈顶元素
    peek() {
        return this.items[this.items.length - 1];
    }
    // 检查栈是否为空
    isEmpty() {
        return this.items.length === 0;
    }
    size() {
        return this.items.length;
    }
    clear() {
        this.items = [];
    }
}
